
import {requestInfo} from '@/api/public.js'

/**
 * 消息中心
 */
export class MessageService {
    // 分页查询列表
    static findMessages (queryParams) {
        return requestInfo({
            url: '/repair/repairManagement/Message/findMessages',
            method: 'POST',
            data: queryParams
        });
    }

    //根据ID查询指定的消息中心
    static findMessage (messageId) {
        const query = {
            messageId
        }
        return requestInfo({
            url: '/repair/repairManagement/Message/findMessage',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的消息中心(包含外键名称)
    static findMessageForView (messageId) {
        const query = {
            messageId
        }
        return requestInfo({
            url: '/repair/repairManagement/Message/findMessageForView',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的消息中心(包含外键名称)
    static findMessageForEdit (messageId) {
        const query = {
            messageId
        }
        return requestInfo({
            url: '/repair/repairManagement/Message/findMessageForEdit',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的消息中心(只提取ID 和 Name)
    static findMessagesWithIdNameById (messageId) {
        const query = {
            messageId
        }
        return requestInfo({
            url: '/repair/repairManagement/Message/findMessagesWithIdNameById',
            method: 'POST',
            params: query,
        });
    }

    //根据名称查询消息中心集合(只提取ID 和 Name)
    static findMessagesWithIdNameByName (messageName) {
        const query = {
            messageName
        }
        return requestInfo({
            url: '/repair/repairManagement/Message/findMessagesWithIdNameByName',
            method: 'POST',
            params: query,
        });
    }

    //新增保存消息中心
    static saveMessage (message) {
        const query = {}
        return requestInfo({
            url: '/repair/repairManagement/Message/saveMessage',
            method: 'POST',
            params: query,
            data: message
        });
    }

    //修改保存消息中心
    static updateMessage (message) {
        const query = {}
        return requestInfo({
            url: '/repair/repairManagement/Message/updateMessage',
            method: 'POST',
            params: query,
            data: message
        });
    }

    //根据ID查询指定的消息中心(只提取ID 和 Name)
    static deleteMessage (messageId) {
        const query = {
            messageId
        }
        return requestInfo({
            url: '/repair/repairManagement/Message/deleteMessage',
            method: 'POST',
            params: query,
        });
    }

    static countNotReadNum(toUserId) {
        const query = {
            toUserId
        }
        return requestInfo({
            url: '/repair/repairManagement/Message/countNotReadNum',
            method: 'POST',
            params: query,
        });
    }

    static readMessage(messageId) {
        const query = {
            messageId
        }
        return requestInfo({
            url: '/repair/repairManagement/Message/readMessage',
            method: 'POST',
            params: query,
        });
    }
}
